<template>
    <div class="view">
        <nav-bar backgroundColor="#7bbcff" color="#fff" title="课程表" :fixed="false">
            <div class="back" slot="left" @click="back">
                <i class="iconfont icon-fanhui"></i>
            </div>
        </nav-bar>
        <calendar></calendar>
    </div>
</template>

<script lang="ts">
    import {Component, Vue} from "vue-property-decorator";
    import Scene from "@/render/Scene";
    import Http from "@/service/Http";
    import {Getter, Action, State, Mutation} from "vuex-class";
    import {InterfaceUser} from "@/interface/InterfaceUser";

    import NavBar from "@/components/aui/NavBar.vue";
    import Calendar from "@/components/aui/Calendar.vue";

    import CommonUnit from "@/unit/CommonUnit";

    @Component({
        components: {
            NavBar, Calendar
        }
    })
    export default class Curriculum extends Scene {

        private scheduleList: Array<object> = [];

        @State("UserStore")
        public user!: InterfaceUser;

        private back() {
            this.navigateBack();
        }

        private mounted(): void {
            Http.get(this.api.getScheduleList, CommonUnit.argumentWithUser(this.user)).then((res) => {
                if (res.Success) {
                    this.scheduleList = res.Data;
                } else {
                    const toast = (<any> this).$createToast({
                        mask: true,
                        type: "warn",
                        time: 1500,
                        txt: res.Message,
                        onTimeout: () => {
                            if (!CommonUnit.responseLoginVerification(res)) {
                                this.navigateLoginPage();
                            }
                        }
                    });
                    toast.show();
                }
            });
        }


    }
</script>

<style scoped lang="stylus">

</style>
